package leetcode_2501_2600;

import java.util.Arrays;

public class LeeCode_2576 {
    public static void main(String[] args) {
        System.out.println(maxNumOfMarkedIndices(new int[]{3, 5, 2, 4}));
    }
    private static int maxNumOfMarkedIndices(int[] nums)     {
        Arrays.sort(nums);
        int n = nums.length;
        int i = 0;
        for (int j = (n + 1) / 2; j < n; j++) {
            if (nums[i] * 2 <= nums[j])
                i++;
        }
        return i * 2;
    }
}